package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchCurveAnalysisResults;
import com.ruoyi.system.service.IDispatchCurveAnalysisResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 曲线分析结果Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchCurveAnalysisResults")
public class DispatchCurveAnalysisResultsController extends BaseController
{
    @Autowired
    private IDispatchCurveAnalysisResultsService dispatchCurveAnalysisResultsService;

    /**
     * 查询曲线分析结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchCurveAnalysisResults dispatchCurveAnalysisResults)
    {
        startPage();
        List<DispatchCurveAnalysisResults> list = dispatchCurveAnalysisResultsService.selectDispatchCurveAnalysisResultsList(dispatchCurveAnalysisResults);
        return getDataTable(list);
    }

    /**
     * 导出曲线分析结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:export')")
    @Log(title = "曲线分析结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchCurveAnalysisResults dispatchCurveAnalysisResults)
    {
        List<DispatchCurveAnalysisResults> list = dispatchCurveAnalysisResultsService.selectDispatchCurveAnalysisResultsList(dispatchCurveAnalysisResults);
        ExcelUtil<DispatchCurveAnalysisResults> util = new ExcelUtil<DispatchCurveAnalysisResults>(DispatchCurveAnalysisResults.class);
        util.exportExcel(response, list, "曲线分析结果数据");
    }

    /**
     * 获取曲线分析结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:query')")
    @GetMapping(value = "/{curveAnalysisResultsId}")
    public AjaxResult getInfo(@PathVariable("curveAnalysisResultsId") Long curveAnalysisResultsId)
    {
        return success(dispatchCurveAnalysisResultsService.selectDispatchCurveAnalysisResultsByCurveAnalysisResultsId(curveAnalysisResultsId));
    }

    /**
     * 新增曲线分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:add')")
    @Log(title = "曲线分析结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchCurveAnalysisResults dispatchCurveAnalysisResults)
    {
        return toAjax(dispatchCurveAnalysisResultsService.insertDispatchCurveAnalysisResults(dispatchCurveAnalysisResults));
    }

    /**
     * 修改曲线分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:edit')")
    @Log(title = "曲线分析结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchCurveAnalysisResults dispatchCurveAnalysisResults)
    {
        return toAjax(dispatchCurveAnalysisResultsService.updateDispatchCurveAnalysisResults(dispatchCurveAnalysisResults));
    }

    /**
     * 删除曲线分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchCurveAnalysisResults:remove')")
    @Log(title = "曲线分析结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{curveAnalysisResultsIds}")
    public AjaxResult remove(@PathVariable Long[] curveAnalysisResultsIds)
    {
        return toAjax(dispatchCurveAnalysisResultsService.deleteDispatchCurveAnalysisResultsByCurveAnalysisResultsIds(curveAnalysisResultsIds));
    }
}
